package com.mxx.bu_yang.dialog;

import android.view.View;
import android.widget.TextView;

import com.mxx.bu_yang.R;
import com.yp.loading.base.BaseDialog;

/**
 * 作者：刘江飞
 * 时间：2020/10/15  10:17
 * 邮箱：642371742Z@qq.com
 * 描述：
 **/
public abstract class CancelSureDialog<T> extends BaseDialog<T> implements View.OnClickListener {
    private TextView tv_cancel;
    private TextView tv_sure;

    @Override
    public boolean isCancelable() {
        return false;
    }

    @Override
    protected boolean isCancelOutside() {
        return false;
    }

    @Override
    protected void initView() {
        super.initView();
        tv_cancel = mRootView.findViewById(R.id.tv_cancel);
        tv_sure = mRootView.findViewById(R.id.tv_sure);
    }

    @Override
    protected void setListener() {
        super.setListener();
        tv_cancel.setOnClickListener(this);
        tv_sure.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == R.id.tv_cancel) {
            leftBtnCancelClick();

        }
        if (view.getId() == R.id.tv_sure) {
            rightBtnSureClick();
        }

    }

    protected void leftBtnCancelClick() {
        dismiss();
    }

    protected abstract void rightBtnSureClick();
}
